package com.kgc.xsProvider.controller;

import com.kgc.basic.util.ResponseMsg;
import com.kgc.xs.pojo.SalesQuotes;
import com.kgc.xs.pojo.SalesQuotesDetail;
import com.kgc.xs.remote.SalesQuotesRemote;
import com.kgc.xsProvider.service.SalesQuotesService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Map;

@Controller
public class SalesController implements SalesQuotesRemote {

    private Logger logger= LoggerFactory.getLogger(getClass());

    @Autowired
    private SalesQuotesService salesQuotesService;

    @Override
    public ResponseMsg selectSalesQuotesByPage(@RequestBody Map<String, Object> map) {
        logger.info("SalesController selectSalesQuotesByPage params{}",map);
        ResponseMsg responseMsg=salesQuotesService.selectSalesQuotesByPage(map);
        logger.debug("SalesController selectSalesQuotesByPage responseMsg{}",responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg insertSalesQuotes(@RequestBody Map<String, Object> map) {
        logger.info("SalesController insertSalesQuotes params{}",map.toString());
        ResponseMsg responseMsg=salesQuotesService.insertSalesQuotes(map);
        logger.debug("SalesController insertSalesQuotes responseMsg{}",responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg updateSalesQuotes(@RequestBody Map<String, Object> map) {
        logger.info("SalesController updateSalesQuotes params{}",map.toString());
        ResponseMsg responseMsg=salesQuotesService.updateSalesQuotes(map);
        logger.debug("SalesController updateSalesQuotes responseMsg{}",responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg deleteSalesQuotes(Map<String, Object> map) {
        logger.info("SalesController deleteSalesQuotes params{}",map.toString());
        ResponseMsg responseMsg=salesQuotesService.deleteSalesQuotes(map);
        logger.debug("SalesController deleteSalesQuotes responseMsg{}",responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg selectSalesQuotesDetailByPage(Map<String, Object> map) {
        logger.info("SalesController selectSalesQuotesDetailByPage params{}",map);
        ResponseMsg responseMsg=salesQuotesService.selectSalesQuotesDetailByPage(map);
        logger.debug("SalesController selectSalesQuotesDetailByPage responseMsg{}",responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg insertSalesQuotesDetail(SalesQuotesDetail salesQuotesDetail) {
        logger.info("SalesController insertSalesQuotesDetail params{}",salesQuotesDetail);
        ResponseMsg responseMsg=salesQuotesService.insertSalesQuotesDetail(salesQuotesDetail);
        logger.debug("SalesController insertSalesQuotesDetail responseMsg{}",responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg updateSalesQuotesDetail(SalesQuotesDetail salesQuotesDetail) {
        logger.info("SalesController updateSalesQuotesDetail params{}",salesQuotesDetail);
        ResponseMsg responseMsg=salesQuotesService.updateSalesQuotesDetail(salesQuotesDetail);
        logger.debug("SalesController updateSalesQuotesDetail responseMsg{}",responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg deleteSalesQuotesDetail(int id) {
        logger.info("SalesController deleteSalesQuotesDetail params{}",id);

        return null;
    }

    @Override
    public ResponseMsg selectSalesQuotesByCode(String doCode) {
        logger.info("SalesController selectSalesQuotesByCode params{}",doCode);
        ResponseMsg responseMsg=salesQuotesService.selectSalesQuotesByCode(doCode);
        logger.debug("SalesController selectSalesQuotesByCode responseMsg{}",responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg selectSalesQuotesDetailByCode(String bjCode) {
        logger.info("SalesController selectSalesQuotesDetailByCode params{}",bjCode);
        ResponseMsg responseMsg=salesQuotesService.selectSalesQuotesDetailByCode(bjCode);
        logger.debug("SalesController selectSalesQuotesDetailByCode responseMsg{}",responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg check(Map<String, Object> map) {
        logger.info("SalesController check params{}",map.toString());
        ResponseMsg responseMsg=salesQuotesService.check(map);
        logger.debug("SalesController check responseMsg{}",responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg selectSalesQuotesByCid(int cid) {
        logger.info("SalesController selectSalesQuotesByCid params{}",cid);
        ResponseMsg responseMsg=salesQuotesService.selectSalesQuotesByCid(cid);
        logger.debug("SalesController selectSalesQuotesByCid responseMsg{}",responseMsg);
        return responseMsg;
    }
}
